package com.lx.pc.service.quotationprice.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.stereotype.Service;

import com.lx.pc.domain.entity.quotationprice.QuotationpriceEntity;
import com.lx.pc.domain.vo.quotationprice.QuotationpriceVo;
import com.lx.pc.mybatis.repository.quotationprice.QuotationpriceRepository;
import com.lx.pc.service.AbstractService;
import com.lx.pc.service.quotationprice.IQuotationpriceService;
import com.lx.pc.utils.OmsPage;

@Service("quotationpriceService")
public class QuotationpriceServiceImpl extends AbstractService<QuotationpriceEntity, QuotationpriceVo, BigInteger, QuotationpriceRepository> implements IQuotationpriceService{

	@Override
	public int findByQuotationpriceCount(QuotationpriceVo quotationprice) {
		
		return repository.findByQuotationpriceCount(quotationprice);
	}

	@Override
	public OmsPage<QuotationpriceVo> findByQuotationprice(QuotationpriceVo quotationprice, Integer page, Integer size) {

		OmsPage<QuotationpriceVo> pages = new OmsPage<QuotationpriceVo>();
		pages.setTotal(repository.findByQuotationpriceCount(quotationprice));
		List<QuotationpriceEntity> list = repository.findByQuotationprice(quotationprice,page = (page - 1) * size,size);
		pages.setResult(etoV(list));
		return pages;
	}

	@Override
	public QuotationpriceVo findByQuotationpriceId(BigInteger id) {

		return etoV(repository.findByQuotationpriceId(id));
	}

}
